#include "sTexturePreset.h"
#include "sTextureResource.h"
#include "sGui.h"

namespace sgui
{
namespace preset
{    

void sTexturePreset::load(const db::Record &file)
{
    sPreset::load(file);
    m_alphaChannel = file[L"alpha"].GetAsBool();
}

void sTexturePreset::save(db::Record &file) const
{
    sPreset::save(file);
    file[L"alpha"].Set(m_alphaChannel);
}
       
engine::sEngineItem* sTexturePreset::createEngineItem(engine::sEngine& engine)
{
	return engine.getTexture((const res::sTextureResource&)getResource(), *this);
}

void sTexturePreset::clear()
{
    sPreset::clear();
    m_alphaChannel = true;
}


#ifdef _EDITOR
void sTexturePreset::exportRTTI(rtti::sInfoList& list)
{
    sPreset::exportRTTI(list);

    REGISTER_RTTI(L"Use Alpha-channel", TEXT, NEW_RTTI_PARAMETER(
		BOOL, sTexturePreset, this, &sTexturePreset::setAlphaChannel, &sTexturePreset::getAlphaChannel
	));
}

#endif

sTexturePreset::sTexturePreset(sGUI&gui, const std::wstring& name, const res::sTextureResource& resource) :
    sPreset(gui, name, resource), m_alphaChannel(true)
{
    //
}

sTexturePreset::~sTexturePreset()
{
    //
}



};
};